package com.learn.yh.aws;

import com.amazonaws.auth.AWSCredentials;

/**
 * @author: Yh
 * @date: 2021/4/6 15:01
 */
final class YamlCredentials implements AWSCredentials {
    private final String accessKey;
    private final String secretKey;

    public YamlCredentials(String accessKey, String secretKey) {
        this.accessKey = accessKey;
        this.secretKey = secretKey;
    }

    public static AWSCredentials of(AwsSecretProperties.Property aws) {
        return new YamlCredentials(aws.getAccessKey(), aws.getSecretKey());
    }

    @Override
    public String getAWSAccessKeyId() {
        return accessKey;
    }

    @Override
    public String getAWSSecretKey() {
        return secretKey;
    }

}
